home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
mdishe
/
string.bas
< prev
next >
Wrap
BASIC Source File
|
1994-12-27
|
4KB
|
161 lines
' ********************************************************
' MDI Standard Application Shell
' ********************************************************
'
' SUMMARY
' -------
' This file is part of an MDI application "skeleton"
' created by John Blessing of Leigh Business Enterprises Ltd.
'
' FEATURES
' --------
' Selection of application database.
' Compact/Repair of database.
' 'Helptips' on toolbar items.
' Support for Help files.
' MDI child forms tiling etc.
' Error trapping.
' 'Nag' screen support for shareware authors.
' Support for 3D dialogs (switched off in design mode
' to prevent GPFs)
'
' USE
' ---
' You need VB Pro to use this shell, although it could be
' modified to run under the standard edition.
'
' You will need to set up some information in APP.BAS,
' particularly in SetAppInfo(). You will also need to add
' your own application specific code to this module.
'
' DISTRIBUTION
' ------------
' This program is "FreeWare" and may be used and distributed
' as you wish.
'
' It incorporates some ideas/code from other authors and these
' are acknowledged in the appropriate module.
'
' We hope that you will find it useful. If you wish to discuss it
' then please e-mail us on Compuserve 100444,623.
'
' ADVERTISEMENT!
' --------------
' Are you looking for a helpdesk system? Or does your company
' want to track and monitor the progress of any work activity?
' We market a system which could be of interest to you.
'
' PROGRESS is available for download from the Business section
' of the Windows Shareware forum on Compuserve
' (filename PRGRSS10.ZIP). It's a large program, so in the
' same section you will also find the help files and
' documentation as PRGSSDOC.ZIP which is quicker to download
' and will give you a good idea of the functionality of PROGRESS.
'
' Dec 1994
'
Option Explicit
'======================================================================
'Form/Module:
' String.bas
'
'Procedure:
' searchreplace
'
'Modifications:
' 25/12/94 JBL Build
'
'Description:
' Replaces all occurences of sSearch in sTarget
' Search is not case sensitive
'======================================================================
'
Sub SearchReplace (sTarget As String, sSearch As String, sReplace As String)
Dim iReplaceAt, isSearchLen, isReplaceLen, isTargetLen As Integer
Dim sTemp As String
'General Error Handler
If Not bDesignMode() Then
On Error GoTo Error_Search
End If
isSearchLen = Len(sSearch)
isReplaceLen = Len(sReplace)
iReplaceAt = InStr(1, sTarget, sSearch, 1)
While iReplaceAt
isTargetLen = Len(sTarget)
'found, so get everything to the left of it
sTemp = Left$(sTarget, iReplaceAt - 1)
'add the replacement text
sTemp = sTemp & sReplace
'add everything to the right of it
sTemp = sTemp & Right$(sTarget, isTargetLen - isSearchLen - iReplaceAt + 1)
sTarget = sTemp
'any more?
iReplaceAt = InStr(1, sTarget, sSearch, 1)
Wend
Exit Sub
Error_Search:
'call the generic error handler
GenErrorHandler "String.bas - SearchReplace()", Err, Error$
'
Resume Exit_Search
'
Exit_Search:
End Sub
'======================================================================
'Form/Module:
' string.bas
'
'Procedure:
' sNullTrim
'
'Modifications:
' 25/12/94 JBL Build
'
'Description:
' strips off trailing null chars as returned by API functions
'======================================================================
'
Function sNullTrim (Incoming As String) As String
Dim iTemp As String
Dim i As Integer
'General Error Handler
If Not bDesignMode() Then
On Error GoTo Error_sNullTrim
End If
iTemp = Incoming
i = InStr(iTemp, Chr$(0))
If i Then iTemp = Left$(iTemp, i - 1)
iTemp = Trim$(iTemp)
sNullTrim = iTemp
Exit Function
Error_sNullTrim:
'call the generic error handler
GenErrorHandler "String.bas - sNullTrim()", Err, Error$
'
Resume Exit_sNullTrim
'
Exit_sNullTrim:
End Function